package com.xpf.service.process;


import com.xpf.service.process.entity.BpmStartDTO;
import com.xpf.service.process.entity.ProcessCommonDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class LanDrayProcessServiceImpl {

    @Resource
    private OperateBaseProcessFactory operateBaseProcessFactory;

    public String startProcess(BpmStartDTO bpmStartDTO){
        System.out.println(bpmStartDTO.getSubject() + "蓝凌oa发起审批调用！");
        return "200";
    }


    public <T extends ProcessCommonDTO> String createProcess(String dataId, T process , String processKey) {
        LanDrayCommonProcessStrategy strategy = operateBaseProcessFactory.getLanDrayProcessStrategy(processKey);
        if (strategy == null) {
            return "【" + processKey + "】匹配不到审批流程";
        }
        return strategy.createProcessBPM(dataId, process);
    }

}
